package com.testing.sunnycommon.quartz;

import com.testing.sunnycommon.service.SunnyRunService;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Classname SunnyRunQuartzJob
 * @Description 类型说明
 * @Date 2023/6/21 11:43
 * @Created by 特斯汀Roy
 */
public class SunnyRunQuartzJob implements Job {
    @Autowired
    public SunnyRunService sunnyRunService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //通过jobDataMap来获取执行中所需要的数据
        JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
        //需要获取的是数据中的projectId
        long projectId = jobDataMap.getLong("projectId");
        //调用service完成运行。
        sunnyRunService.runTest(projectId);
    }
}
